import { type TypedUseSelectorHook, useDispatch as useDispatchT, useSelector as useSelectorT } from "react-redux";
import { configureStore } from "@reduxjs/toolkit";

import publicReducer from "./modules/publicReducer";

const store = configureStore({
	reducer: {
		public: publicReducer
	}
});

type IStoreState = ReturnType<typeof store.getState>;
type IStoreDispatch = typeof store.dispatch;
const useSelector: TypedUseSelectorHook<IStoreState> = useSelectorT;
const useDispatch: () => IStoreDispatch = useDispatchT;

export { useDispatch, useSelector };
export default store;
